﻿$(function () {
    //确认提交
    $("input[type='submit']").click(function () {
        if (confirm("确认提交？")) {
            return true;
        }
        else {
            return false;
        }
    });

    $("input[id='Approve']").click(function () {
        if (confirm("同意该图书订单？")) {
            return true;
        }
        else {
            return false;
        }
    });

    $("input[id='Rejected']").click(function () {
        if (confirm("拒绝该图书订单？")) {
            return true;
        }
        else {
            return false;
        }
    });

    $("input[id='Closed']").click(function () {
        if (confirm("完成该图书订单？")) {
            return true;
        }
        else {
            return false;
        }
    });

    $("input[id='Revoked']").click(function () {
        if (confirm("撤销该图书订单？")) {
            return true;
        }
        else {
            return false;
        }
    });


    $("#checkInfo").bind("click", function () {
        $.ajax({
            url: "ConfirmInfo",
            type: "GET",
            data: { "isbn": $("input#ISBN").val() },
            dataType: "json",
            success: function (data) {
                $("#labelISBN").empty();
                $("#labelBookName").empty();
                $("#labelStorageArea1").empty();
                $("#labelStorageArea2").empty();
                $("#labelholdUser").empty();
                $.each(data.Data.list, function (i, item) {
                    $("#labelISBN").append("<input value='" + item.ISBN + "id=ISBN" + " />");
                    $("#labelBookName").append("<input value='" + item.BookName + "id=BookName" + " />");
                    $("#labelStorageArea1").append("<input value='" + item.StorageArea1 + "id=StorageArea1" + " />");
                    $("#labelStorageArea2").append("<input value='" + item.StorageArea2 + "id=StorageArea2" + " />");
                    $("#labelholdUser").append("<input value='" + item.HoldUser + "id='holdUser'" + " />");
                });
            }
        });
    });



    //日期
    var pickerOpts = {
        changeMonth: true,
        changeYear: true,
        dateFormat: "yy/mm/dd",
        dayNamesMin: ["日", "一", "二", "三", "四", "五", "六"],
        firstDay: 0,
        nextText: "下一月",
        prevText: "上一月",
        monthNamesShort: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"],
        isRTL: false,
        showButtonPanel: false,
        yearRange: "-25:+25"
    }
    $('#s_time').datepicker(pickerOpts);
    $('#e_time').datepicker(pickerOpts);

//        $('#s_time').datepicker();
//        $('#e_time').datepicker();

});